﻿ /// <reference path="~/js/jquery.js" />
$(function () {

    //IE87兼容 input
    //console.log($("html").hasClass("ie"))
    if ($("html").hasClass("lt10")) {
        $('input').placeholder();
    }
    //end
	
	  //shop_kefu
	  $(".shop_kefu #kefu_close").click(function(){
		 $(".shop_kefu .kefu_con").animate({right:"-125%"});
		 $(".shop_kefu .kefu_but").show();
	  });
	  
	  $(".shop_kefu .kefu_but").click(function(){
		 $(".shop_kefu .kefu_con").animate({right:"0px"});
		 $(".shop_kefu .kefu_but").hide();
	  });
	  
	  
	  
		
	  
	  //reg_tcbut
	  $(".reg_tcbut").click(function(){
		$(".reg_tcbg").show();							 
		$(".reg_tc").show();							 
	  })
	  
	  //reg_tcbg
	  $(".reg_tcbg").click(function(){
		$(".reg_tcbg").hide();							 
		$(".reg_tc").hide();							 
	  })
	  
	  //project_tc
//	  $(".team_but .release_project").click(function(){
//		$(".project_tcbg").show();							 
//		$(".project_tc").show();							 
//	  })
	  
	  //project_tcbg
	  $(".project_tcbg").click(function(){
		$(".project_tcbg").hide();							 
		$(".project_tc").hide();							 
	  })
	  
	  
	
	
	$(".in_task ul li:last-child").addClass("last01");
	$(".in_platform ul li:last-child").addClass("last01");
	$(".show_lb ul li:nth-child(4n)").addClass("mar0");
	$(".show_works_imglb a:nth-child(4n)").addClass("mar3");
	$(".new_journal ul li:last-child").addClass("last01");
	$(".my_team ul li:nth-child(3n)").addClass("mar0");
	$(".sub_security .split_ratio dl dd:nth-child(5n)").addClass("mar0");
	
/*	$(".mem_login .wechat_sub").click(function(){
		$(".weixin_tcbg").show();
		$(".weixin_tc").show();
	});
	
	$(".weixin_tcbg").click(function(){
		$(".weixin_tcbg").hide();
		$(".weixin_tc").hide();
	});
*/	
	//添加日期插件
//	$(".date_input").each(function(){
//	$(this).calendar() 
//	})	
	
	
	
//	$(".members dl dd .operation .span02").click(function(){
//	  $(this).parent().parent().remove();
//	})

/*    $(".team_invitation ul li .team_work img").click(function(){
		 var hasChk = $(this).parent().next("input").is(':checked');
		 if(hasChk){
			  $(this).parent().next("input").removeAttr("checked");
		 }else{
			  $(this).parent().next("input").attr("checked",'checked');
		 }
											
		
	});
	
*/	
	
	$(".team_invitation ul li .team_work").each(function(e){
		$(this).find("img").click(function(x){
			//$(".radio_bon").eq(e).find(".radio .radio_hidden").val($(this).attr("data-val"));
			
			 var hasChk = $(this).parent().next("input").is(':checked');
			 if(hasChk){
				  $(this).parent().next("input").removeAttr("checked");
			 }else{
				  $(this).parent().next("input").prop("checked",'true');
			 }
			
		})
		
		
		
		
	})
	
	
	$(".new_class dl dd span").click(function(){
	   $(this).addClass("hover01").siblings().removeClass("hover01");
	});
	
	$(".new_sort dl dd span").click(function(){
	   $(this).addClass("hover01").siblings().removeClass("hover01");
	});
	
	$(".mem_process ul li a").click(function(){
		$(".mem_process ul li a").removeClass("hover01");									 
		$(this).addClass("hover01");									 
	});
	
	
	 //模拟单选按钮
	$(".radio_bon").each(function(e){
		$(this).find("span").click(function(x){
			$(".radio_bon").eq(e).find("span").removeClass("on");
			$(this).addClass("on")
			$(".radio_bon").eq(e).find(".radio .radio_hidden").val($(this).attr("data-val"))
		})
	})
	//
		
	 //模拟复选按钮
		$(".check_bon span").click(function(){
											
		 if($(this).hasClass("on")){
			  $(this).removeClass("on");
			  $(this).find(".check").removeAttr("checked");
		 }else{
			  $(this).addClass("on");
			  $(this).find(".check").attr("checked",'true');
		 }
											
											
	})
	//
	
  //star
  $(".star label").click(function(){
	var i = $(this).index();
	$(this).siblings().removeClass("label01");
	for(var j=0;j<i;j++){
		$(this).siblings().eq(j).addClass("label01");
		$(this).addClass("label01");
    }
  });
	
//	$(".team_invitation .join_but").click(function(){
//		$(".mem_join").show();
//		setTimeout(function () {
//		  $(".mem_join").hide();
//		}, 3000);
//		
//	});
	
//	$(".my_team .select").click(function(){
//		$(".mem_join").show();
//		setTimeout(function () {
//		  $(".mem_join").hide();
//		}, 3000);
//	});
	
	
	//banner
    var winH = $(window).height();
    var winW = $(window).width();
    var phaH = winW*0.2865;
	var upH = $(".team_work .up").width();
    $(".team_work .up").css({height:upH+"px"});
	
	var upH2 = $(".per_infor .up2").width()*0.5691;
    $(".per_infor .up2").css({height:upH2+"px"});
		
	var memH = $(".team_detailcon ul li .members dl dd").width();
    $(".team_detailcon ul li .members dl dd .auto-img").css({height:memH+"px"});
	
	var teammemH = $(".my_team_list ul li dl dd").width();
    $(".my_team_list ul li dl dd .auto-img").css({height:teammemH+"px"});
	
	
	if(winW>767){
	  $(".banner ul li a").css({height:280+"px"});
	}else{
	  $(".banner ul li a").css({height:phaH+"px"});
	  var upH2 = $(".per_infor .up2").width()*0.39;
      $(".per_infor .up2").css({height:upH2+"px"});
	  
	}
	
		//username
		if(winW>747){
				  $(".top .top_rt .username").hover(function(){
					 $(this).addClass("hover01");
				  },function(){
					 $(this).removeClass("hover01");
				  });
			}else{
				  $(".top .top_rt .username").click(function(){
					if($(this).find("dd").is(":hidden")){
					  $(this).addClass("hover01");
				     }else{
					  $(this).removeClass("hover01"); 
					}										 
				  })
			}
	
	
		//shouye banner
		 $(".banner ul li").each(function(i){
			  if(winW>767){
				 simg=$(this).find("a").data("big");
				 $(this).find("a").css({"background-image":'url('+simg+')'});
			  }else{
				 srcl=$(this).find("a").data("phone");
				 $(this).find("a").css({"background-image":'url('+srcl+')'});
			  }
		
		  })
		 
		 
  if(winW>747){

	var showW = $(".show_lb ul li").width();
	if(showW>220){
		showW=220;
	}
	$(".show_lb ul li").find(".divimg").css({height:showW+"px"});
	$(".show_lb ul li").find(".auto-img").css({height:showW+"px"});
	
	
    //show_cattle_people		 
	var showW2 = $(".show_cattle_people ul li").width();
	if(showW2>108){
		showW2=108;
	}
	$(".show_cattle_people ul li").find(".divimg").css({height:showW2+"px"});
	$(".show_cattle_people ul li").find(".auto-img").css({height:showW2+"px"});
	
  }else{
	
	var showW = $(".show_lb ul li").width();
	$(".show_lb ul li").find(".divimg").css({height:showW+"px"});
	$(".show_lb ul li").find(".auto-img").css({height:showW+"px"});
	
	
    //show_cattle_people		 
	var showW2 = $(".show_cattle_people ul li").width();
	$(".show_cattle_people ul li").find(".divimg").css({height:showW2+"px"});
	$(".show_cattle_people ul li").find(".auto-img").css({height:showW2+"px"});
	
  }
	

	
	$(window).resize(function () {
		var winH = $(window).height();
		var winW = $(window).width();
		var phaH = winW*0.2865;
		
		var upH = $(".team_work .up").width();
		$(".team_work .up").css({height:upH+"px"});

		var upH2 = $(".per_infor .up2").width()*0.5691;
		$(".per_infor .up2").css({height:upH2+"px"});

		if(winW>767){
		  $(".banner ul li a").css({height:280+"px"});
		}else{
		  $(".banner ul li a").css({height:phaH+"px"});
		  		  
		}
		
	   var memH = $(".team_detailcon ul li .members dl dd").width();
       $(".team_detailcon ul li .members dl dd .auto-img").css({height:memH+"px"});

	   var teammemH = $(".my_team_list ul li dl dd").width();
       $(".my_team_list ul li dl dd .auto-img").css({height:teammemH+"px"});

		//username
		if(winW>747){
				  $(".top .top_rt .username").hover(function(){
					 $(this).addClass("hover01");
				  },function(){
					 $(this).removeClass("hover01");
				  });
			}else{
				  $(".top .top_rt .username").click(function(){
					if($(this).find("dd").is(":hidden")){
					  $(this).addClass("hover01");
				     }else{
					  $(this).removeClass("hover01"); 
					}										 
				  })
			}
		
		

		//shouye banner
		 $(".banner ul li").each(function(i){
			  if(winW>747){
				 simg=$(this).find("a").data("big");
				 $(this).find("a").css({"background-image":'url('+simg+')'});
			  }else{
				 srcl=$(this).find("a").data("phone");
				 $(this).find("a").css({"background-image":'url('+srcl+')'});
			  }
		
		  })
		 
		 
		 
                //图片自动auto
                if ($(".auto-img").is(":visible"))
                {
                    $(".auto-img img").one('load', function() {
			        mainBgResize(this, 1, 1);
                        }).each(function() {
			        if(this.complete) $(this).load();
                        });
                }
                //

    //show_lb
	
  if(winW>747){

	var showW = $(".show_lb ul li").width();
	if(showW>220){
		showW=220;
	}
	$(".show_lb ul li").find(".divimg").css({height:showW+"px"});
	$(".show_lb ul li").find(".auto-img").css({height:showW+"px"});
	
	
    //show_cattle_people		 
	var showW2 = $(".show_cattle_people ul li").width();
	if(showW2>108){
		showW2=108;
	}
	$(".show_cattle_people ul li").find(".divimg").css({height:showW2+"px"});
	$(".show_cattle_people ul li").find(".auto-img").css({height:showW2+"px"});
	
  }else{
	
	var showW = $(".show_lb ul li").width();
	$(".show_lb ul li").find(".divimg").css({height:showW+"px"});
	$(".show_lb ul li").find(".auto-img").css({height:showW+"px"});
	
	
    //show_cattle_people		 
	var showW2 = $(".show_cattle_people ul li").width();
	$(".show_cattle_people ul li").find(".divimg").css({height:showW2+"px"});
	$(".show_cattle_people ul li").find(".auto-img").css({height:showW2+"px"});
	
  }
  
  
		//phote_nav
		var navHD = $(".phote_head").height();
		var searchHD = $(".search").height();
		var winH2 = winH*0.15;
		var nav_h = winH - navHD - searchHD - winH2;
		
		if (winW < 747) {
			$(".head-menu nav").addClass("scroll");
			$(".head-menu .scroll").css({height:nav_h+"px"});
		    $(".phote_nav .search").css({top:navHD+"px"});
            $(".mobile-bon").show();
		}else{
	        $(".head-menu nav").removeClass("scroll");
			$(".head-menu nav").css({height:"auto"});
		    $(".phote_nav .search").css({top:6+"px"});
            $(".mobile-bon").hide();
	    }
			
		
	
	})
	
	
	//phote_nav
	var navHD = $(".phote_head").height();
	var searchHD = $(".search").height();
	var winH2 = winH*0.15;
	var nav_h = winH - navHD - searchHD - winH2;
	
	if (winW < 747) {
	    $(".head-menu nav").addClass("scroll");
		$(".head-menu .scroll").css({height:nav_h+"px"});
		$(".phote_nav .search").css({top:navHD+"px"});
        $(".mobile-bon").show();
   }else{
	    $(".head-menu nav").removeClass("scroll");
	    $(".head-menu nav").css({height:"auto"});
		$(".phote_nav .search").css({top:6+"px"});
        $(".mobile-bon").hide();
	}
	
	
	
	
	$("#back_to_top").click(function(){
		$("html,body").animate({scrollTop:"0px"}, 500);
	});


    //分享
    var title_2 = encodeURIComponent("小果兔");
    $(".team_share .a-1").click(function () {//新浪微博
        var url = $(this).attr("date-href")
        var img = ""
        var title = $(this).attr("data-info")
        var op = "http://service.weibo.com/share/share.php?url=" + encodeURIComponent(url) + "&title=" + title + "&searchPic=" + img + ""
        window.open(op)
    })
	
    $(".weixinbut").click(function () {//微信
        var url = $(this).attr("date-href")
        //alert(url)
        var title = ""
        title += "<div class='weixin'>"
        title += "<i class='c'>x</i>"
        title += "<h2>二维码</h2>"
        title += "<div class='img'><img src='" + url + "' width='100px;' height='100px;'></div>"
        title += "<p>扫一扫</p>"
        title += "</div>"
        $("body").remove(".weixin");
        $("body").append(title)
        //var op="http://service.weibo.com/share/share.php?url='"+ url +"'&title='"+ title +"'&searchPic=false"
        //window.open(op)
    })
    $(document).on("click", ".weixin .c", function () {
        //alert(0)
        $(".weixin").remove();
    })
        //
	
    $(".team_share .a-3").click(function () {//腾讯微博
        var url = $(this).attr("date-href")
        var img = ""
        var title = $(this).attr("data-info")
        var op = "http://share.v.t.qq.com/index.php?c=share&a=index&title=" + title + "&url=" + encodeURIComponent(url) + "&pic=" + img + ""
        window.open(op)
    })
	
	
	


    //--------------模拟下拉
    $(document).on("click", ".select-box dt", function (e) {
        e.preventDefault();
        e.stopPropagation();

        $(this).toggleClass("open");
        $(this).parents(".select-box").find("dd").toggle();
    })
    $(document).on("click", ".select-box dd a", function (e) {
        $(this).addClass("on").siblings().removeClass("on");
        $(this).parents(".select-box").find("dt b").text($(this).text());
        $(this).parents(".select-box").next(".select-hidden").val($(this).attr("data-val"));
       // e.preventDefault();
        //e.stopPropagation();
        $(".select-box dt").removeClass("open");
        $(".select-box dd").hide();
    })
    $(document).click(function () {
        $(".select-box dt").removeClass("open");
        $(".select-box dd").hide();

    })
    //end
	
	
	


})
//end

//radio_bon
jQuery(document).ready(function(){

        //模拟下拉
				$(".select_0").each(function(i){
					$(this).find("dt").click(function(e){
						e.preventDefault();
						e.stopPropagation()
						$(".select_0").eq(i).find("dd").show();
						$(".select_0").eq(i).find("dd a").each(function(x){
							$(this).click(function(){
								$(".select_0").eq(i).find("dd a").removeClass("on")
								$(this).addClass("on")
								$(".select_0").eq(i).find("dt").text($(this).text())
								$(".select_0").eq(i).next(".select_hidden").val($(this).attr("data-val"))
							})
						})	
					})
				})
				$(document).click(function(){
					$(".select_0 dd").hide();
				})
				//模拟下拉end	
								
					          
});


// 设置为主页
function SetHome(obj,vrl){
try{
obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
}
catch(e){
if(window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}
catch (e) {
alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage',vrl);
}else{
alert("您的浏览器不支持，请按照下面步骤操作：1.打开浏览器设置。2.点击设置网页。3.输入："+vrl+"点击确定。");
}
}
}
// 加入收藏 兼容360和IE6
function shoucang(sTitle,sURL)
{
try
{
window.external.addFavorite(sURL, sTitle);
}
catch (e)
{
try
{
window.sidebar.addPanel(sTitle, sURL, "");
}
catch (e)
{
alert("加入收藏失败，请使用Ctrl+D进行添加");
}
}
}


//无图图像
var nullimg=publicPath+'/images/error.png';
function lod(t){
	t.onerror = null;
	t.src=nullimg
}
$(document).ready(function(){
	$("img").each(function(){
	if($(this).attr("src")=="")
	{
		$(this).attr({"src":nullimg})
	}
	})

	
})
//
